﻿<phone:PhoneApplicationPage xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"  xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"  
    x:Class="DBFM7.View.MainPage"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ctl="clr-namespace:DBFM7"
    xmlns:AppBarUtils="clr-namespace:AppBarUtils;assembly=AppBarUtils"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    DataContext="{Binding MainPage,Source={StaticResource Locator}}">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="BackKeyPress">
            <cmd:EventToCommand Command="{Binding BackKeyPressCommand}"
                                 PassEventArgsToCommand="True"
                        />
            
        </i:EventTrigger>
    </i:Interaction.Triggers>
      <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>

    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent" >

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="DB.FM 7" Style="{StaticResource PhoneTextNormalStyle}"/>
        </StackPanel>
        <Grid  Margin="0,20,0,0" VerticalAlignment="Center">

            <StackPanel Orientation="Horizontal" x:Name="sp_selectedChannel"  HorizontalAlignment="Center" >
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="DoubleTap">
                        <cmd:EventToCommand Command="{Binding ChannelNameDoubleTapCommand}"
                        />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
                <TextBlock x:Name="selecteChannel"  Text="{Binding ChannelName}" FontSize="45"  TextAlignment="Center" />
                <TextBlock   FontSize="30"  TextAlignment="Center" Text="mhz"  VerticalAlignment="Bottom" />
            </StackPanel>

        </Grid>
        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,20,0,0">
                <TextBlock x:Name="PlayTime" HorizontalAlignment="Center" Text="{Binding PlayTime}" Margin="0,0,0,8"/>
                <StackPanel x:Name="AlubmImage_Double" Margin="0,1,0,0"  >
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="ManipulationCompleted">
                            <cmd:EventToCommand Command="{Binding ManipulationCompletedCommand}"
                                                 PassEventArgsToCommand="True"
                        />
                        </i:EventTrigger>
                        <i:EventTrigger EventName="ManipulationStarted">
                            <cmd:EventToCommand Command="{Binding ManipulationStartedCommand}"
                                                 PassEventArgsToCommand="True"
                        />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                    <Image x:Name="AlubmImage" Source="{Binding SongImg}" 
                           Width="360" Height="360" Stretch="Fill"
                           Opacity="1"
                            ImageOpened="AlubmImage_ImageOpened">
                    </Image>

                    <Image x:Name="AlubmImage_Copy" Source="{Binding SongImg}" Width="360" Height="40.182" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Stretch="Fill" Opacity="0.3">
                	<Image.OpacityMask>
                		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                			<GradientStop Color="#00000000" Offset="0.0"/>
                			<GradientStop Color="#FF000000" Offset="0.1"/>
                		</LinearGradientBrush>
                	</Image.OpacityMask>
                	<Image.RenderTransform>
                		<CompositeTransform Rotation="-0.087" ScaleY="-1" SkewX="39.154" TranslateX="16.318" TranslateY="-0.025"/>
                	</Image.RenderTransform>
                	</Image>
                </StackPanel>
                <Canvas  x:Name="CavSongName">
                    <Canvas.Resources>
                        <Storyboard x:Name="sb">
                            <DoubleAnimation x:Name="animation"
                            Storyboard.TargetProperty="(Canvas.Left)"
                            Storyboard.TargetName="SongName"
                            Duration="0:0:9"
                            RepeatBehavior="Forever" />
                        </Storyboard>
                    </Canvas.Resources>
                    
                    <TextBlock Loaded="SongName_Loaded" x:Name="SongName" FontSize="24"  Text="{Binding SongInfo}" Margin="0,15,0,0" />
                </Canvas>
            </StackPanel>
        </Grid>
        <!--Sample code showing usage of ApplicationBar-->

        <Path Stroke="#FFE2C9C9" StrokeThickness="2" >
            <Path.Data>
                <LineGeometry StartPoint="20,130" EndPoint="460,130" />
            </Path.Data>
        </Path> 

    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar >
        <shell:ApplicationBar x:Name="AppBar"  Opacity="1.0" IsVisible="True" IsMenuEnabled="True" >
            <shell:ApplicationBarIconButton  IconUri="/ICON/appbar.favs.addto.rest.png" Text="btnFav"/>
            <shell:ApplicationBarIconButton IconUri="/ICON/appbar.transport.pause.rest.png"  Text="btnPlay"/>
            <shell:ApplicationBarIconButton   IconUri="/ICON/appbar.transport.ff.rest.png" Text="btnNext"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="关于" Click="About_Click"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    <i:Interaction.Behaviors>
        <AppBarUtils:AppBarItemCommand Id="btnFav" Text="最爱"  IconUri="{Binding BtnFavIcon}" Command="{Binding FavCommand}" />
        <AppBarUtils:AppBarItemCommand Id="btnPlay" Text="{Binding PlayBtnText}"   IconUri="{Binding BtnPlayIcon}" Command="{Binding PlayCommand}"/>
        <AppBarUtils:AppBarItemCommand Id="btnNext" Text="下一首"  Command="{Binding NextCommand}" />
    </i:Interaction.Behaviors>
</phone:PhoneApplicationPage>